#include "string.h"
#include "sys.h"
#include "ui.h"

char hello[] = "Hello, World!";

// setup the entry point
/*void entry() {
  asm("lui sp, 0x00120"); // set stack to high address of the dmem
  asm("addi sp, sp, -4");
  main();
}*/

int main() {
  //core_main();
  vga_init();
  ui_mainloop();
  //char buf[100];
  /*while (1) {
    gets("zcy>", buf);
    if (!strcmp(buf, "hello"))
      puts(hello);
    else if (!strcmp(buf, "time")) {
      do {
        TIME t = time();
        uint16_t ms = t.ms;
        uint16_t s = t.s;
        uint16_t min = t.min;
        char time_buf[100];
        itoa(min, time_buf, 10);
        int len1 = strlen(time_buf);
        putstr(time_buf);
        putstr(" : ");
        itoa(s, time_buf, 10);
        int len2 = strlen(time_buf);
        putstr(time_buf);
        putstr(" : ");
        itoa(ms, time_buf, 10);
        int len3 = strlen(time_buf);
        putstr(time_buf);
        for (int i = 0; i < len1 + len3 + len2 + 6; ++i, putch('\b'))
          ;
      } while (head == *key_tail);
      getch();
      puts("");
    } else if (strStr(buf, "fib") != -1) {
      int i = strStr(buf, "fib");
      puts(itoa(fib(atoi(buf + i + 5, 10)), buf, 10));
    } else if (!strcmp(buf, "fuck"))
      puts("Sit back and relax.");
    else if (!strcmp(buf, "clear")) {
      vga_init();
      continue;
    } else
      puts(buf);
  }
  return 0;*/
}